package io;

import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Li_yizYa
 * Date: 2025—04—21
 * Time: 21:18
 */
public class Demo1 {
    public static void main(String[] args) throws IOException {
//        File file = new File("E:\\code_java\\demo\\test.txt");// 绝对路径
        File file = new File("./test.txt");
        // 获取当前的目录
        System.out.println(file.getParent());
        // 获取文件名
        System.out.println(file.getName());
        // 获取路径
        System.out.println(file.getParent());
        // 获取绝对路径
        System.out.println(file.getAbsolutePath());
        // 获取相对路径
        System.out.println(file.getCanonicalPath());
    }
}
